package com.huike.clues.service.impl;


import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import com.huike.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {

    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;

    @Autowired
    private TbClueMapper tbClueMapper;

    /**
     * 添加跟进记录表  并修改信息
     * @param tbClue
     * @param trackRecord
     * @return
     */
    @Override
    @Transactional
    public int addAndUpdate(TbClue tbClue, TbClueTrackRecord trackRecord) {
        //修改线索表数据
        tbClueMapper.updateTbClue(tbClue);
        //线索跟进表添加数据
        return tbClueTrackRecordMapper.insertById(trackRecord);


    }
    /**
     * 查询线索跟进记录列表
     */
    @Override
    public List<TbClueTrackRecord> selectByClueId(Long clueId) {

        return tbClueTrackRecordMapper.selectByClueId(clueId);
    }


}
